Ci-joint une version modifiée de l'importation en format CSV des comptes.
Elle prend en compte la nouvelle ligne Détail du format CSV des relevés de la Banque Postale
N'hésitez pas à compléter la liste des idées d'évolution...
-- Fabrice
Pour utiliser la modification ci dessous il suffit de copier-coller le code dans le fichier import_csv.py (faites une sauvegarde de l'ancien fichier avant!)
#_______________________________________________________________________________
# 2.3 (2007-02-27)
# Traite correctement les fichiers de la Banqe Postale
#_______________________________________________________________________________
import BP
Acc = BP.AccountCurrent()
dateFmts, Seps, mapping, Show = ["JMA", "MJA", "AMJ"], [";", ",", "\t"], [0, 0, 0, 0, 0, 0, 0, 0, 0], [50, 100, 500]
fields = ["Date", "Mode", "Tiers", "Détails", "Catégorie", "Sous-catégorie", "Montant", "Débit", "Crédit"]
MrkList = ["Non Pointé", "Pointé", "Rapproché"]
l, b, CC, cs, cb = "TLabel", "TButton", CreateComponent, "csDropDownList", "TComboBox"
CSV = []
def Import(S):
global DateFmt
for i in range(len(mapping)): mapping[i] = Combos[i].ItemIndex
if mapping[0] <= 0: s = "La date n'est pas spécifiée !"
elif (mapping[6] > 0 and mapping[7] > 0) or (mapping[6] > 0 and mapping[8] > 0): s = "Débit/Crédit OU Montant !"
elif mapping[6] <= 0 and (mapping[7] <= 0 or mapping[8] <= 0): s = "Le montant n'est pas spécifié !"
else: s = ""
if s:
LMsg.Caption = s
return
s = EStart.Text
if s.isdigit(): sLine = int(s)
else: sLine = 2
if sLine < 1: sLine = 1
mark = CBMark.ItemIndex
for i in range(len(MrkList)):
if mark == MrkList[i]: mark = i
s = EEnd.Text
if s.isdigit(): eLine = int(s)
else: eLine = 0
if eLine < sLine: eLine = 0
DateFmt = dateFmts[CBDate.ItemIndex]
records, min_date = linestodict(CSV, Seps[CBSep.ItemIndex], sLine, eLine)
currLines, Light = CurrentLines(min_date)
idx = CBDup.ItemIndex
Count = len(records)
i = 0
for r in records:
line = FmtLine(r)
i += 1
date, mode, tier, info, catg, mont = r.get("Date", ""), r.get("Mode", ""), r.get("Tiers", ""), r.get("Détails", ""), r.get("Catégorie", ""), r.get("Montant", "")
if not IsDate(date): report["Dates incorrectes"].append(line)
elif mont == "" or abs(mont) < 0.0001: report["Montants incorrects"].append(line)
else:
insertDupl, idx = TestDup(i, Count, idx, currLines, Light, (date, mode, tier, info, mont), date, simplecheck(mode), mont, line)
if insertDupl == "ko": continue
if catg == "": catg = -1
mode, tier, info = SCheckNum(mode, tier, info)
count1 = BP.OperationCount[Acc]
date = Date2Str(date)
BP.LineAdd(Acc, date, mode, tier, info, catg, mont, mark)
count2 = BP.OperationCount[Acc]
if count2 == count1: report["Lignes refusées"].append(line)
else: report["Opérations importées"].append(line)
BP.AccountRefreshScreen()
MRes.Lines.Text = Errors(report)
FF.ShowModal()
F0.Close()
#_____________________________________________________________
def draw(S, ACol, ARow, R, State):
cv = S.Canvas
if "gdSelected" in State: cv.Brush.Color = 0x00dec5b9
elif ARow > 0 and ARow % 2 == 0: cv.Brush.Color = 0x00f5f5f5
cv.FillRect(R)
try:
if ARow == 0:
if ACol == 0: s = "n°"
else: s = "Col. %d" %ACol
cv.Font.Style = ["fsBold"]
else: s = cells[ARow - 1][ACol]
except:
s = ""
if ACol == 0 and ARow > 0: cv.Font.Color = 0x000000CC
else: cv.Font.Color = 0x00000000
if s != "": cv.TextRect(R, R.Left + 3, R.Top + 5, s)
cv.Brush.Style = 1
#_____________________________________________________________
def Resize(S):
Grid.DefaultColWidth = (Grid.Width - 40) / Grid.ColCount
#_____________________________________________________________
def FillGrid(S):
global cells
i = CBShow.ItemIndex
if i < 3: L = CSV[:Show[i]]
else: L = CSV
s = Seps[CBSep.ItemIndex]
cells = [["%d" %(i + 1)] + l.split(s) for i, l in enumerate(L)]
cols = max([len(l) for l in cells])
Grid.ColCount, Grid.RowCount = cols, len(cells)
for cb in Combos:
cb.Items.Text = "--\n" + "\n".join([str(i) for i in range(1, cols)])
cb.ItemIndex = mapping[i]
Resize(S)
#_____________________________________________________________
F0 = CC("TForm", None)
F0.SetProps(Position = "poMainFormCenter", Width=800, Height=480, Caption = "Paramètres de l'import")
CC(l, F0).SetProps(Parent=F0, Left=20, Top=25, Caption="Date / Sépar. :")
CC(l, F0).SetProps(Parent=F0, Left=20, Top=50, Caption="Doublons :")
CC(l, F0).SetProps(Parent=F0, Left=20, Top=75, Caption="Première/dern. ligne :")
CC(l, F0).SetProps(Parent=F0, Left=20, Top=126, Caption="Pointage :")
LFld = CC(l, F0)
LFld.SetProps(Parent=F0, Left=20, Top=155, Caption="Champ")
LMap = CC(l, F0)
LMap.SetProps(Parent=F0, Left=130, Top=155, Width=45, Caption="Colonne")
LMsg = CC(l, F0)
LMsg.SetProps(Parent=F0, Left=20, Top=410)
LMsg.Font.Color = 0x000000CC
CBDate = CC(cb, F0)
CBDate.SetProps(Parent=F0, Left=130, Top=20, Width=48, Style=cs)
CBDate.Items.Text = "\n".join(dateFmts)
CBDate.ItemIndex = 0
CBSep = CC(cb, F0)
CBSep.SetProps(Parent=F0, Left=183, Top=20, Width=48, Style=cs, OnChange=FillGrid)
CBSep.Items.Text = ";\n,\nTAB"
CBSep.ItemIndex = 0
CBDup = CC(cb, F0)
CBDup.SetProps(Parent=F0, Left=130, Top=45, Width=100, Style=cs)
CBDup.Items.Text = "Tout accepter\nTout refuser\nDemander"
CBDup.ItemIndex = 2
EStart = CC("TEdit", F0)
EStart.SetProps(Parent=F0, Left=130, Top=70, Width=48, Text="2")
EEnd = CC("TEdit", F0)
EEnd.SetProps(Parent=F0, Left=183, Top=70, Width=48)
CCtgs = CC("TCheckBox", F0)
CCtgs.SetProps(Parent=F0, Left=20, Top=100, Width=200, Caption="Créer les catégories manquantes", Checked=0)
CBMark = CC(cb, F0)
CBMark.SetProps(Parent=F0, Left=130, Top=122, Width=100, Style=cs)
CBMark.Items.Text = "\n".join(MrkList)
CBMark.ItemIndex = 0
Grid = CC("TDrawGrid", F0)
Grid.SetProps(Parent=F0, Left=250, Top=20, Width=525, Height=375, Anchors=["AkLeft", "akTop", "akRight", "akBottom"], FixedCols=0, OnDrawCell=draw, Options = ["goFixedHorzLine", "goVertLine", "goDrawFocusSelected", "goRowSelect", "goThumbTracking"])
CBShow = CC(cb, F0)
CBShow.SetProps(Parent=F0, Left=250, Top=407, Width=125, Style=cs, Anchors=["akLeft", "akBottom"], OnChange=FillGrid)
CBShow.Items.Text = "Afficher 50 lignes\r\nAfficher 100 lignes\r\nAfficher 500 lignes\r\nTout afficher"
CBShow.ItemIndex = 0
CC(b, F0).SetProps(Parent=F0, Left=625, Top=405, Width=70, Height=25, Caption="Annuler", Cancel=1, Anchors=["akRight", "akBottom"], ModalResult=2)
CC(b, F0).SetProps(Parent=F0, Left=705, Top=405, Width=70, Height=25, Caption="Importer", Default=1, OnClick=Import, Anchors=["akRight", "akBottom"])
F0.OnResize=Resize
FDup = CC("TForm", None)
FDup.SetProps(Width=400, Height=390, Position="poMainFormCenter", BorderStyle="bsSingle", BorderIcons=["biSystemMenu"], Caption="Détection de doublons")
l0 = CC(l, FDup)
l0.SetProps(Parent=FDup, Left=20, Top=20)
l1 = CC(l, FDup)
l1.SetProps(Parent=FDup, Left=20, Top=60, Caption="Ligne à insérer :")
l2 = CC(l, FDup)
l2.SetProps(Parent=FDup, Left=20, Top=190, Caption="Ligne existante :")
CC(l, FDup).SetProps(Parent=FDup, Left=40, Top=80, Caption="Date :")
CC(l, FDup).SetProps(Parent=FDup, Left=40, Top=100, Caption="Mode :")
CC(l, FDup).SetProps(Parent=FDup, Left=40, Top=120, Caption="Tiers :")
CC(l, FDup).SetProps(Parent=FDup, Left=40, Top=140, Caption="Détails :")
CC(l, FDup).SetProps(Parent=FDup, Left=40, Top=160, Caption="Montant :")
CC(l, FDup).SetProps(Parent=FDup, Left=40, Top=210, Caption="Date :")
CC(l, FDup).SetProps(Parent=FDup, Left=40, Top=230, Caption="Mode :")
CC(l, FDup).SetProps(Parent=FDup, Left=40, Top=250, Caption="Tiers :")
CC(l, FDup).SetProps(Parent=FDup, Left=40, Top=270, Caption="Détails :")
CC(l, FDup).SetProps(Parent=FDup, Left=40, Top=290, Caption="Montant :")
lD = CC(l, FDup)
lD.SetProps(Parent=FDup, Left=120, Top=80)
lM = CC(l, FDup)
lM.SetProps(Parent=FDup, Left=120, Top=100)
lT = CC(l, FDup)
lT.SetProps(Parent=FDup, Left=120, Top=120)
lI = CC(l, FDup)
lI.SetProps(Parent=FDup, Left=120, Top=140)
lA = CC(l, FDup)
lA.SetProps(Parent=FDup, Left=120, Top=160)
LD = CC(l, FDup)
LD.SetProps(Parent=FDup, Left=120, Top=210)
LM = CC(l, FDup)
LM.SetProps(Parent=FDup, Left=120, Top=230)
LT = CC(l, FDup)
LT.SetProps(Parent=FDup, Left=120, Top=250)
LI = CC(l, FDup)
LI.SetProps(Parent=FDup, Left=120, Top=270)
LA = CC(l, FDup)
LA.SetProps(Parent=FDup, Left=120, Top=290)
lD.Font.Color = lM.Font.Color = lT.Font.Color = lI.Font.Color = lA.Font.Color = LD.Font.Color = LM.Font.Color = LT.Font.Color = LI.Font.Color = LA.Font.Color = 0x00CC0000
CC(b, FDup).SetProps(Parent=FDup, Left=40, Top=320, Width=75, Height=25, Caption="Oui", ModalResult=6)
CC(b, FDup).SetProps(Parent=FDup, Left=120, Top=320, Width=75, Height=25, Caption="Non", ModalResult=7)
CC(b, FDup).SetProps(Parent=FDup, Left=200, Top=320, Width=75, Height=25, Caption="Toutes", ModalResult=10)
CC(b, FDup).SetProps(Parent=FDup, Left=280, Top=320, Width=75, Height=25, Caption="Aucune", ModalResult=9)
#_____________________________________________________________
FF = CC("TForm", None)
FF.SetProps(Width=640, Height=450, Position="poMainFormCenter", BorderStyle="bsSingle", BorderIcons=["biSystemMenu"], Caption="Résultat de l'import")
CC(b, FF).SetProps(Parent=FF, Left=270, Top=370, Width=100, Height=25, Caption="Fermer", ModalResult=1, Cancel=1, Default=1)
MRes = CC("TMemo", FF)
MRes.SetProps(Parent=FF, Left=30, Top=30, Width=580, Height=350, Anchors=["akTop","akLeft", "akRight", "akBottom"], WordWrap=0, Readonly=1)
l0.Font.Style = l1.Font.Style = l2.Font.Style = LMap.Font.Style = LMsg.Font.Style = LFld.Font.Style = ["fsBold"]
F0.Font.Name = FF.Font.Name = FDup.Font.Name = "Tahoma"
#_____________________________________________________________
def Date2Str(d):
y, m, d = d
if y < 100: y += 2000
return "%02d/%02d/%04d" %(d, m, y)
#_____________________________________________________________
def Errors(report):
ok = 0
ko = 0
lines = []
for key in report.keys():
l = report[key]
num = len(l)
if num == 0: continue
if key == "Opérations importées": ok += num
else: ko += num
l = [" %s" %s for s in l]
lines.append("%s (%d) :\r\n\r\n%s" %(key, num, "\r\n".join(l)))
total = ok + ko
if total == 0:
s = "Il n'y a aucune ligne à importer depuis le fichier"
else:
if ko == 0:
if total == 1: s = "L'opération contenue dans le fichier CSV a été importée sans erreurs"
else: s = "Les %d opérations contenues dans le fichier CSV ont été importées sans erreurs" %total
elif ok == 0: s = "Aucune ligne n'a pu être importée"
else:
if ok == 1: s = "Une opération sur %d a été importée" %(total)
else: s = "%d opérations sur %d ont été importées" %(ok, total)
s = "%s\r\n\r\n%s" %(s, "\r\n\r\n".join(lines))
return s
#_____________________________________________________________
def IsDate(t):
try:
y, m, d = t
if (m == 2) and (y % 4 == 0) and ( (y % 100 != 0) or (y % 400 == 0) ): Max = 29
else: Max = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][m - 1]
return m > 0 and m < 13 and d > 0 and d <= Max
except:
return 0
#_____________________________________________________________
def FmtLine(dic):
s = []
for key in dic.keys():
v = dic[key]
if key == "Date": v = Date2Str(v)
s.append("%s : %s" %(key, v))
s.sort()
return ", ".join(s)
#_____________________________________________________________
def Str2Date(d):
Seps = "/-' .;"
d = d.replace("-", "/").replace(".", "/").replace("'", "/").replace(" ", "").split("/")
if len(d) != 3 or not d[0].isdigit() or not d[1].isdigit() or not d[2].isdigit(): return None
d = [int(d[0]), int(d[1]), int(d[2])]
if DateFmt == "JMA": return (d[2], d[1], d[0])
elif DateFmt == "MJA": return (d[2], d[0], d[1])
elif DateFmt == "AMJ": return (d[0], d[1], d[2])
elif DateFmt == "AJM": return (d[0], d[2], d[1])
else: return None
#_____________________________________________________________
def Str2Float(value):
s = value
s = s.replace("$", "").replace(" ", "").replace("€", "").replace("F", "").replace(",", ".")
if "." in s:
l = s.split(".")
s = "%s.%s" %( "".join(l[:-1]), l[-1] )
try:
f = float(s)
except:
return None
return f
#_____________________________________________________________
def GetCtg(cat, sub):
cat, sub = cat.strip(), sub.strip()
if cat == "" and sub == "": return -1
cat, sub = Pattern(cat), Pattern(sub)
if cat == "" and sub == "": return -1
if cat == "" or sub == "":
t = cat + sub
if t in CtgPatt: return CtgPatt.index(t)
else:
for i in range(len(CtgPatt)):
c = CtgPatt[i]
if t in c or c in t > -1: return i
else:
match1 = [c for c in categs1 if cat in c[0] or c[0] in cat]
match2 = [c for c in categs2 if sub in c[0] or c[0] in sub]
if len(match1) == 0 and len(match2) == 0: t = cat
else:
if len(match1) == 0: return match2[0][1]
if len(match2) == 0: return match1[0][1]
parent_indexes = [m[1] for m in match1]
for m in match2:
if m[2] in parent_indexes: return m[1]
return match2[0][1]
if CCtgs.Checked:
BP.CategAdd(t, 0)
return BP.CategCount() - 1
else: return -1
#_____________________________________________________________
def Pattern(v):
ko = "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÑÒÓÔÕÖÙÚÛÜÝßàáâãäåæçèéêëìíîïñòóôõöùúûüýÿABCDEFGHIJKLMNOPQRSTUVWXYZ"
ok = "aaaaaaaceeeeiiiinooooouuuuybaaaaaaaceeeeiiiinooooouuuuyyabcdefghijklmnopqrstuvwxyz"
exclude = " -.,;:/!?'_"
s = ""
for c in v:
i = ko.find(c)
if i > -1: s += ok[i]
elif not c in exclude: s += c
return s
#_____________________________________________________________
def getmode(value, sign):
value = value.strip()
if value != "":
if sign == -1 and value.isdigit(): return "Chq %s" %value
v = Pattern(value)
if sign == 1: fmodes = {"Versement": ["vers", "esp"], "Dépôt de chèque": ["rem", "dep", "ch"], "Virement reçu": ["vir", "vrm", "vrt"]}
else: fmodes = {"Carte": ["fac", "cb", "car", "achatcarte", "achatcb"], "Retrait DAB": ["ret", "dab", "distrib", "automat"], "Chèque émis": ["ch"], "Prélèvement": ["pr"], "Virement émis": ["vir", "vrm", "vrt"], "TIP": ["tip"]}
for m in fmodes.keys():
fpatterns = fmodes[m]
for fpattern in fpatterns:
if v.find(fpattern) == 0:
if m == "Chèque émis":
v = value.split(" ")[-1].split(".")[-1].split("°")[-1].split("Q")[-1].split("E")[-1].split("H")[-1]
if v.isdigit(): return "Chq %s" %v
return m
if sign == 1: return "Virement reçu"
else: return "Prélèvement"
#_____________________________________________________________
def linetodict(line, sep):
d = {}
print line
cols = line.split(sep)
for i in range(len(fields)):
field = fields[i]
num_col = mapping[i] - 1
if num_col == -1: continue
if num_col >= len(cols): value = ""
else: value = cols[num_col]
if len(value) > 2 and value[0] == '"' and value[-1] == '"': value = value[1:-1]
if field == "Date": value = Str2Date(value)
elif (field == "Montant" or field == "Débit" or field == "Crédit") and value != "":
value = Str2Float(value)
if field == "Débit": value = -abs(value)
elif field == "Crédit": value = abs(value)
if value != None:
if value > 0: sign = 1
elif value < 0: sign = -1
else: sign = 0
field = "Montant"
if value != None and field != "Débit" and field != "Crédit": d[field] = value
d["Catégorie"] = GetCtg(d.get("Catégorie", ""), d.get("Sous-catégorie", ""))
try:
if sign != 0: d["Mode"] = getmode(d.get("Mode", ""), sign)
return d
except:
return None
#_____________________________________________________________
def linestodict(CSV, sep, sLine, eLine):
global report
report = {"Opérations importées" : [], "Dates incorrectes" : [], "Montants incorrects" : [], "Enregistrements incorrects" : [], "Lignes refusées" : [], "Doublons" : []}
min_date, records = (3000, 12, 31), []
if eLine > 0 and eLine >= sLine: CSV = CSV[sLine - 1:eLine]
else: CSV = CSV[sLine - 1:]
for l in CSV:
if l.strip() == "": continue
try: record = linetodict(l, sep)
except: record = None
if record != None:
if not record.has_key("Date"): report["Dates incorrectes"].append(l)
elif not record.has_key("Montant"): report["Montants incorrects"].append(l)
else:
y, m, d = record["Date"]
if y < 100: y += 2000
record["Date"] = (y, m, d)
if (y, m, d) < min_date: min_date = (y, m, d)
records.append(record)
else: report["Enregistrements incorrects"].append(l)
return records, min_date
#_____________________________________________________________
def TestDup(N, T, ask, Lines, Light, R, d, m, v, line):
if ask == 0: res = "ok", ask
elif not (d, m, v) in Light: res = "ok", ask
elif ask == 1: res = "ko", ask
else:
i = Light.index((d, m, v))
l = Lines[i]
lD.Caption, lM.Caption, lT.Caption, lI.Caption, lA.Caption = Date2Str(R[0]), R[1], R[2], R[3], R[4]
LD.Caption, LM.Caption, LT.Caption, LI.Caption, LA.Caption = Date2Str(l[0]), l[1], l[3], l[4], l[2]
l0.Caption = "La ligne %d/%d ressemble à une ligne existante.\nSouhaitez-vous l'insérer ?" %(N, T)
i = FDup.ShowModal()
res = {6: ("ok", ask), 10: ("ok", 0), 7: ("ko", ask), 9: ("ko", 1)}[i]
if res[0] == "ko": report["Doublons"].append(line)
return res
#_____________________________________________________________
def simplecheck(s):
return [s, "Chèque émis"][s.find("Chq") == 0]
#_____________________________________________________________
def CurrentLines(from_date):
i = Acc
lines = zip(BP.OperationDate[i], BP.OperationMode[i], BP.OperationAmount[i], BP.Operationthirdparty[i], BP.OperationDetails[i])
lines = [((int(dt[6:10]), int(dt[3:5]), int(dt[0:2])), mode, value, people, details) for (dt, mode, value, people, details) in lines if (int(dt[6:10]), int(dt[3:5]), int(dt[0:2])) >= from_date]
lines_search = [(l[0], simplecheck(l[1]), l[2]) for l in lines]
return lines, lines_search
#_____________________________________________________________
def SCheckNum(mode, tier, info):
if mode == "Chèque émis" and tier != "":
num = tier.split("°")[-1].split(" ")[-1]
if num.isdigit(): mode = "Chq %s" %num
else:
num = info.split("°")[-1].split(" ")[-1]
if num.isdigit(): mode = "Chq %s" %num
if mode.find("Chq ") == 0:
if info == "": info = "n°%s" %(mode[4:])
else: info = "n°%s %s" %(mode[4:], info)
mode = "Chèque émis"
return mode, tier, info
#_____________________________________________________________
def guess(mapping, title_line, sep):
titles = title_line.split(sep)
titles = [Pattern(t) for t in titles]
cols = range(len(titles))
fs = [["date"], ["mode", "type"], ["tiers"], ["details", "note", "notes"], ["categorie", "categ"], ["souscategorie", "sscategorie", "sscateg", "souscateg", "scateg", "scategorie"], ["montant"], ["debit"], ["credit"]]
for i in range(len(fs)):
possibles = fs[i]
for col in cols:
if titles[col] in possibles:
mapping[i] = col + 1
break
#_____________________________________________________________
CtgPatt = [Pattern(c) for c in BP.CategName]
parents = BP.CategParent
categs1 = [(CtgPatt[i], i) for i in range(len(CtgPatt)) if parents[i] == i]
categs2 = [(CtgPatt[i], i, parents[i]) for i in range(len(CtgPatt)) if parents[i] != i]
Combos = []
Path = BP.OpenDialog("Choisissez le fichier à importer", "\\", ".csv", "Comma Separated Values (*.CSV)|*.csv|Vidéoposte (*.TSV)|*.tsv")
if Path != "":
if Path[-3:] == "tsv": mapping, EStart.Text, CBSep.ItemIndex = [1, 2, 2, 3, 0, 0, 4, 0, 0], "9", 2
#<patch v2.1> 02/07/2004
#CSV = [l.strip() for l in open(Path, "r").readlines()]
CSVTemp = []
CSVTemp = [l.strip() for l in open(Path, "r").readlines()]
sTmpLine = ""
sSep = ""
sSep = Seps[CBSep.ItemIndex]
bAddLine = 0
iDetailStart = 0
iDetailEnd = 0
for l in CSVTemp:
iDetailStart = l.find(sSep + '"')
iDetailEnd = l.find('"' + sSep)
print "iDetailStart : " + str(iDetailStart)
print "iDetailEnd : " + str(iDetailEnd)
# Details sur 1 ligne :
# 24/01/2007;"CHEQUE N° 234587";-38,00;-249,26
if (iDetailStart > -1) and (iDetailEnd > -1) and iDetailStart < iDetailEnd:
sTmpLine = l.replace('"' + sSep, '"' + sSep + sSep)
l = sTmpLine.replace('"', '')
sTmpLine = ""
bAddLine = 0
# 1ere ligne de Détail
# 25/01/2007;"ACHAT CB BP NANTERRE 23.01.07
# CARTE NUMERO 789";-30,00;-196,79
if iDetailStart > iDetailEnd:
sTmpLine = l.replace('"', '')
bAddLine = 1
continue
# 2eme ligne de Détail
if iDetailEnd and bAddLine:
l = sTmpLine + sSep + l.replace('"', '')
sTmpLine = ""
bAddLine = 0
CSV.append(l)
#</patch 2.1>
FillGrid(None)
cols = "--\n" + "\n".join([str(i) for i in range(1, Grid.ColCount)])
if sum(mapping) == 0: guess(mapping, CSV[0], Seps[CBSep.ItemIndex])
for i in range(len(mapping)):
CC("TLabel", F0).SetProps(Parent=F0, Left=20, Top=i * 25 + 178, Caption=fields[i])
cb = CC("TComboBox", F0)
cb.SetProps(Parent=F0, Left=130, Width=50, Top=i * 25 + 175, Style=cs)
cb.Items.Text = cols
cb.ItemIndex = mapping[i]
Combos.append(cb)
F0.ShowModal()
27/02/07
24/02/07
04/03/2007
-- Fabrice